package com.hbm.usercenter.base;

import android.app.Application;
import android.content.Context;
import android.os.Handler;

import com.hbm.usercenter.http.OkHttp3Downloader;
import com.squareup.picasso.Picasso;

import okhttp3.OkHttpClient;

public class BaseApplication extends Application {
	private static Context mContext;
	private static Handler mHandler;
	private static long mMainThreadId;
	private static Thread mCurrentThread;

	public static Picasso mPicasso;

	public void setUpPicasso(){

		Picasso picasso = new Picasso.Builder(this)
				.downloader(new OkHttp3Downloader(new OkHttpClient()))
				.build();
		Picasso.setSingletonInstance(picasso);
		mPicasso = picasso;
	}

	public static Picasso getPicasso(){
		return mPicasso;
	}


	public static Context getContext() {
		return mContext;
	}

	public static Handler getHandler() {
		return mHandler;
	}

	public static long getMainThreadId() {
		return mMainThreadId;
	}

	public static Thread getCurrentThread() {
		return mCurrentThread;
	}


	@Override
	public void onCreate() {
		
		mContext = getApplicationContext();
		mHandler = new Handler();
		mMainThreadId = android.os.Process.myTid();
		mCurrentThread = Thread.currentThread();
		setUpPicasso();
		super.onCreate();
	}
}
